/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 张宇田
 * Date: 2024-09-21
 * Time: 15:27
 */
import java.util.Scanner;

public class ATM {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int balance = 1000; //
        int withdrawAmount;
        int option;

        System.out.println("欢迎使用中国人民银行ATM取款机");

        while (true) {
            System.out.println("输入取款金额：");
            withdrawAmount = scanner.nextInt();

            if (withdrawAmount > balance) {
                System.out.println("目前余额：" + balance + "无法满足您的取款需求！");
                continue;
            }

            balance -= withdrawAmount;
            System.out.println("剩余金额：" + balance + "，是否继续（'1'：结束，'2'：继续）：");
            option = scanner.nextInt();

            if (option == 1) {
                System.out.println("取款结束！");
                break;
            }
        }

        scanner.close();
        /*****end*****/
    }
}

